Boltzmann Machines as Ising Models

by Peter de Blanc + ChatGPT o1 pro
Posted to Adarie (www.adarie.com) on March 19, 2025
Content License: Creative Commons BY (Attribution)


First, let us state the problem precisely:

The usual relationship between the original bits xi{0,1}x_i \in \{0,1\} and Ising spins si{1,+1}s_i \in \{-1,+1\} is

si  =  2xi    1xi  =  si+12.s_i \;=\; 2\,x_i \;-\; 1 \quad\Longleftrightarrow\quad x_i \;=\; \frac{s_i + 1}{2}.

Below, we walk through how to find the new parameters b~i\widetilde{b}_i and w~ij\widetilde{w}_{ij} so that

E(s)  =  ib~isi    i<jw~ijsisjE'(\mathbf{s}) \;=\; -\sum_i \widetilde{b}_i\,s_i \;-\;\sum_{i<j} \widetilde{w}_{ij}\,s_i\,s_j

differs from the original energy E(x(s))E(\mathbf{x}(\mathbf{s})) by only a constant (ensuring the same Boltzmann distribution).


1. Rewrite the old energy in terms of s\mathbf{s}

Start with

E(x)  =  ibixi    i<jwijxixj.E(\mathbf{x}) \;=\; -\,\sum_i b_i\,x_i \;-\; \sum_{i<j} w_{ij}\,x_i\,x_j.

Substitute xi=si+12x_i = \tfrac{s_i + 1}{2}. Then

E(x(s))  =  ibi(si+12)    i<jwij  (si+12)(sj+12).E\bigl(\mathbf{x}(\mathbf{s})\bigr) \;=\; -\,\sum_i b_i \,\Bigl(\frac{s_i + 1}{2}\Bigr) \;-\; \sum_{i<j} w_{ij}\;\Bigl(\frac{s_i + 1}{2}\Bigr)\,\Bigl(\frac{s_j + 1}{2}\Bigr).

We can expand this step by step.

1.1 Expand the linear term

ibisi+12  =  i(bi2si+bi2)  =  ibi2si    ibi2.-\sum_i b_i \,\frac{s_i + 1}{2} \;=\; -\sum_i \Bigl(\frac{b_i}{2}\,s_i + \frac{b_i}{2}\Bigr) \;=\; -\sum_i \frac{b_i}{2}\,s_i \;-\; \sum_i \frac{b_i}{2}.

1.2 Expand the pairwise term

i<jwij  (si+12)(sj+12)  =  i<jwij4  (si+1)(sj+1).-\sum_{i<j} w_{ij}\;\Bigl(\frac{s_i + 1}{2}\Bigr)\,\Bigl(\frac{s_j + 1}{2}\Bigr) \;=\; -\sum_{i<j} \frac{w_{ij}}{4}\;\bigl(s_i + 1\bigr)\bigl(s_j + 1\bigr).

Now expand (si+1)(sj+1)=sisj+si+sj+1\bigl(s_i + 1\bigr)\bigl(s_j + 1\bigr) = s_i s_j + s_i + s_j + 1. Hence

i<jwijsisj+si+sj+14  =  i<j(wij4sisj  +  wij4si  +  wij4sj  +  wij4).-\sum_{i<j} w_{ij}\,\frac{s_i s_j + s_i + s_j + 1}{4} \;=\; -\sum_{i<j} \Bigl( \frac{w_{ij}}{4}\,s_i s_j \;+\; \frac{w_{ij}}{4}\,s_i \;+\; \frac{w_{ij}}{4}\,s_j \;+\; \frac{w_{ij}}{4} \Bigr).

Combine everything:

E(x(s))  =  ibi2si    i<jwij4sisj    ibi2    i<jwij4si    i<jwij4sj    i<jwij4.E\bigl(\mathbf{x}(\mathbf{s})\bigr) \;=\; -\sum_i \frac{b_i}{2}\,s_i \;-\; \sum_{i<j} \frac{w_{ij}}{4}\,s_i s_j \;-\; \sum_i \frac{b_i}{2} \;-\; \sum_{i<j} \frac{w_{ij}}{4}\,s_i \;-\; \sum_{i<j} \frac{w_{ij}}{4}\,s_j \;-\; \sum_{i<j} \frac{w_{ij}}{4}.

2. Group terms by type

We want to match

E(s)  =  ib~isi    i<jw~ijsisj  +  constant.E'\bigl(\mathbf{s}\bigr) \;=\; -\sum_i \widetilde{b}_i\,s_i \;-\; \sum_{i<j} \widetilde{w}_{ij}\,s_i s_j \;+\;\text{constant}.

So let us group together the isi\sum_i s_i terms, the i<jsisj\sum_{i<j} s_i s_j terms, and constants.

2.1 Pairwise terms in sisjs_i s_j

From above, the coefficient in front of sisjs_i s_j is wij4- \tfrac{w_{ij}}{4}. Hence we identify

w~ij  =  wij4.\widetilde{w}_{ij} \;=\; \frac{w_{ij}}{4}.

2.2 Linear terms in sis_i

Look at all terms linear in sis_i. There are two sources:

  1. From ibi2si-\sum_i \tfrac{b_i}{2}\,s_i, we get a contribution bi2si-\tfrac{b_i}{2}\,s_i.

  2. From i<jwij4(si+sj)-\sum_{i<j} \tfrac{w_{ij}}{4} (s_i + s_j), each sis_i gets contributions from all jij\neq i.

Putting it all together, for each ii:

bi2si    jiwij4si  =  (bi2+14jiwij)si.-\frac{b_i}{2}\,s_i \;-\; \sum_{j\neq i} \frac{w_{ij}}{4}\,s_i \;=\; -\biggl( \frac{b_i}{2} + \frac{1}{4}\sum_{j\neq i} w_{ij} \biggr)\,s_i.

Hence,

b~i  =  bi2  +  14  jiwij.\widetilde{b}_i \;=\; \frac{b_i}{2} \;+\; \frac{1}{4}\;\sum_{j\neq i} w_{ij}.

2.3 Constant terms

These do not affect the probabilities (they only multiply the partition function by a constant). Collecting them:

ibi2    i<jwij4.-\sum_i \frac{b_i}{2} \;-\; \sum_{i<j} \frac{w_{ij}}{4}.

So overall, in terms of a new energy E(s)E'(\mathbf{s}), we can drop that constant or just keep in mind it is an additive shift.


3. Final transformation

Putting it all together:

  1. Spin re-labeling: si=2xi1s_i = 2x_i - 1.
  2. New couplings: w~ij  =  wij4.\widetilde{w}_{ij} \;=\; \frac{w_{ij}}{4}.
  3. New biases: b~i  =  bi2  +  14jiwij.\widetilde{b}_i \;=\; \frac{b_i}{2} \;+\; \frac{1}{4}\,\sum_{j \neq i} w_{ij}.
  4. Additive constant (often omitted in the final expression) is constant  =  ibi2    i<jwij4.\text{constant} \;=\; -\,\sum_i \frac{b_i}{2} \;-\; \sum_{i<j} \frac{w_{ij}}{4}.

Hence the Ising-form energy in s{1,+1}n\mathbf{s}\in\{-1,+1\}^n that reproduces the same Boltzmann distribution as the original {0,1}\{0,1\}-valued Boltzmann machine is:

E(s)  =  i(bi2+14jiwij)si    i<jwij4sisj  +  (constant).E'(\mathbf{s}) \;=\; -\sum_{i} \biggl( \frac{b_i}{2} + \tfrac{1}{4}\,\sum_{j \neq i} w_{ij} \biggr)\,s_i \;-\; \sum_{i<j} \frac{w_{ij}}{4}\,s_i\,s_j \;+\; \text{(constant)}.

Summary of the Parameter Transformation

These formulas preserve the same Boltzmann distribution but rewrite it for spins taking values in {1,+1}\{-1,+1\}.